﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using olierFrm.Extensions.EString;
using olierFrm.MVC;
using System.Data;

namespace MvcApplication1.Controllers
{
    public class VisaController : AutoController
    {
        [AcceptVerbs(HttpVerbs.Get), Compress]
        public string Site()
        {
            DataTable dtVisaSite = this.SmartPageGet.StdQuery.Tables["VisaSite"];
            List<object> oo = new List<object>();
            for (int i = 0; i < dtVisaSite.Rows.Count; i++)
            {
                oo.Add(new
                {
                    label = dtVisaSite.Rows[i]["SiteCN"] + " " + dtVisaSite.Rows[i]["SiteEN"],
                    value = dtVisaSite.Rows[i]["SiteCN"],
                    sitePY = dtVisaSite.Rows[i]["SitePY"],
                    siteEN = dtVisaSite.Rows[i]["SiteEN"],
                    sitePY2 = dtVisaSite.Rows[i]["SitePYPronunciation"],
                    siteID = dtVisaSite.Rows[i]["SiteID"]
                });
            }
            return oo.ToJSON();
        }
        [AcceptVerbs(HttpVerbs.Get), Compress]
        public string MaterialType()
        {
            DataTable dtMaterialType = this.SmartPageGet.StdQuery.Tables["MaterialType"];
            List<object> oo = new List<object>();
            for (int i = 0; i < dtMaterialType.Rows.Count; i++)
            {
                oo.Add(new
                {
                    label = dtMaterialType.Rows[i]["MaterialDesc"],
                    value = dtMaterialType.Rows[i]["VisaMaterialTypeID"]
                });
            }
            return oo.ToJSON();
        }
    }
}
